package cn.bdqn.service.impl;

import cn.bdqn.entity.Film;
import cn.bdqn.dao.FilmDao;
import cn.bdqn.service.FilmService;
import org.springframework.stereotype.Service;
import java.util.List;
import javax.annotation.Resource;

@Service
public class FilmServiceImpl implements FilmService {
    @Resource
    private FilmDao filmDao;

    @Override
    public List<Film> queryAll() {
        return this.filmDao.queryAll();
    }
    
    @Override
    public Film queryById(Integer filmId) {
        return this.filmDao.queryById(filmId);
    }
    @Override
    public Film insert(Film film) {
        this.filmDao.insert(film);
        return film;
    }

    @Override
    public Film update(Film film) {
        this.filmDao.update(film);
        return this.queryById(film.getFilmId());
    }

    @Override
    public boolean deleteById(Integer filmId) {
        return this.filmDao.deleteById(filmId) > 0;
    }
}
